.PHONY:all
all: libmymath.so libmymath.a

libmymath.so:mymath.o myprint.o
	gcc -shared -o libmymath.so mymath.o myprint.o
mymath.o:mymath.c
	gcc -fPIC -c mymath.c -o mymath.o
myprint.o:myprint.c
	gcc -fPIC -c myprint.c -o myprint.o

libmymath.a:mymath_s.o myprint_s.o
	ar -rc libmymath.a mymath.o myprint_s.o
mymath_s.o:mymath.c
	gcc -c mymath.c -o mymath_s.o
myprint_s.o:myprint.c
	gcc -c myprint.c -o myprint_s.o

.PHONY:lib
lib:
	mkdir -p lib-static/lib
	mkdir -p lib-static/include
	cp *.a lib-static/lib
	cp *.h lib-static/include

	mkdir -p lib-dyl/lib
	mkdir -p lib-dyl/include
	cp *.so lib-dyl/lib
	cp *.h lib-dyl/include

.PHONY:clean
clean:
	rm -rf *.o *.a *.so lib*


	
# .PHONY:dyl
# dyl:
# 	mkdir -p lib-dyl/lib
# 	mkdir -p lib-dyl/include
# 	cp *.so lib-dyl/lib
# 	cp *.h lib-dyl/include